﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YasharEl.Infrastructure.SoftwareModel.SOA
{
    /// <summary>
    /// Entity Services unlock and surface the business entities in the system. 
    /// They can be thought of as the data-centric components ("nouns") 
    /// of the business process: employee, customer, sales order, and so on. 
    /// 
    /// Examples of Entity Services include a customers service that manages the customers' information, 
    /// or an orders service that manages the orders that customers placed.
    /// 
    /// Entity Services abstract data stores (such as SQL Server or Active Directory) 
    /// and expose the information stored in one or more data stores in the system through a service interface. 
    /// Therefore, it is fair to say that Entity Services manage the persistent state of the system. 
    /// In some cases, the information they manage transcends a specific system 
    /// and is used in several or even all the systems in the organization.
    /// 
    /// It is very common for Entity Services to support a create, read, update and delete (CRUD) interface at the entity level, 
    /// and add additional domain-specific operations needed to address 
    /// the problem-domain and support the application's features and use cases. 
    /// 
    /// An example of a domain-specific operation is a customers service 
    /// that exposes a method called FindCustomerByLocation 
    /// that can locate a customer's ID given the customer's address.
    /// 
    /// The information that Entity Services manage typically exists 
    /// for a time span that is longer than that of any single business process. 
    /// The information that Entity Services expose is typically structured, 
    /// as opposed to the relational or hierarchical data stores that are being fronted by the service. 
    /// 
    /// For example, a service may aggregate the information stored in several database tables 
    /// or even several separate databases and project that information as a single entity.
    /// 
    /// In some cases, typically for convenience reasons, 
    /// Entity Service implementers choose to expose the underlying data as data sets 
    /// rather than strongly-schematized XML data.
    /// Even though data sets are not entities in the strict sense,
    /// those services are still considered Entity Services for classification purposes.
    /// 
    /// Users of Entity Services may require that a permission 
    /// be configured for them in order to use the service,
    /// be it at the application, user, or the application-user scope. 
    /// These permissions may apply restrictions on data access and/or changes at the "row" (entity) 
    /// or "column" (entity-element) level. 
    /// An example of "column" level restriction would be that an HR application 
    /// might have access to both the social security and home address elements 
    /// of the employee entity while a check-printing service 
    /// may only have access to the home address element. 
    /// An example of "row" level restriction would be an expense report application 
    /// that lets managers see and approve expense reports for employees 
    /// that report to them, but not for employees who do not report to them.
    /// 
    /// Error compensation in Entity Services is mostly limited to seeking alternative data sources, if at all. 
    /// For example, if an Entity Service fails to access a local database 
    /// it may try to reach out to a remote copy of the database to obtain the information needed. 
    /// 
    /// To support system-state consistency, 
    /// Entity Service may support tightly coupled distributed atomic transactions.
    /// Services that support distributed atomic transactions participate in transactions 
    /// that are flowed to them by callers, and subject any state changes 
    /// in the underlying data store to the outcome of these distributed atomic transactions. 
    /// 
    /// To allow for a lower degree of state-change coupling, 
    /// Entity Services may provide support for the more loosely coupled Reservation Pattern, 
    /// either in addition to or instead of supporting distributed atomic transactions.
    /// 
    /// Entity Services are often built in-house as a wrapper over an existing database.
    /// These services are typically implemented by writing code to map database records to entities 
    /// and exposing them on a service interface, 
    /// or by using a software factory to generate the mapping code and service interface. 
    /// 
    /// The Web Services Software Factory from Microsoft's Patterns & Practices 
    /// group is an example of such a software factory. 
    /// In some cases, the database (Microsoft's SQL Server 2005, for example) 
    /// or data-centric application (SAP, for instance) will natively provide facilities 
    /// that enable access to the data through a service interface, 
    /// eliminating the need to generate and maintain a separate Entity Service.
    /// 
    /// Entity Services are often used in more than one composite application and thus they are typically centrally managed.
    /// </summary>
    public interface IEntityService : IApplicationService
    {
    }
}
